import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入公共css
import '@/style/index.scss' // global css

// 引入element-ui库
import elementUI from 'element-ui'

import 'element-ui/lib/theme-chalk/index.css';
Vue.use(elementUI);
import {
  Message
} from 'element-ui'


import './assets/icons'






// Vue.use(elementUI)

Vue.config.productionTip = false


// 若是没有开启Devtools工具，在开发环境中开启，在生产环境中关闭
if (process.env.NODE_ENV == 'development') {
  Vue.config.devtools = true;
} else {
  Vue.config.devtools = false;
}


import CountryFlag from 'vue-country-flag'
Vue.component('country-flag', CountryFlag)




import language_config from '@/utils/language/index';

Vue.directive('l', {
  inserted: function(el, binding) {
    let language_s = localStorage.getItem('language') || 'en';
    if (binding.value) {
        el.innerHTML = language_config[language_s][binding.value];
    }
  },

});

router.beforeEach((to, from, next) => {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;

  // 兼容IE
  window.scrollTo(0, 0);
  next();
})


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
